<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('药企管理列表')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: jquery-smartwizard-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="col-sm-12 search-collapse ifcomebody1">
        <form id="formId">
            <div class="select-list">
                <ul>
                    <li>
                        <label>国家 </label>
                        <select class="form-control m-b" name="countryId" id="countryId"
                                th:with="type=${@commonService.countryKeyAndValue()}" data-placeholder="请选择国家名称"
                                lay-search="">
                            <option value="">请选择国家名称</option>
                            <option th:each="dict : ${type}" th:text="${dict.vals}"
                                    th:value="${dict.keyName}"></option>
                        </select>
                    </li>
                    <li>
                        <label>药企名称 </label>
                        <input type="text" name="name" placeholder="请输入药企名称"/>
                    </li>
                    <li>
                        <a class="btn btn-chongzhi btn-rounded mr16 btn-sm" onclick="$.form.reset()">重置</a>
                        <a class="btn btn-chaxun  mr16 btn-rounded btn-sm" onclick="$.table.search()">查询</a>
                    </li>
                </ul>
            </div>
        </form>
    </div>

    <div class="btn-group-sm" style="display: flex;" id="toolbar" role="group">
        <a class="btn btn-dataadd" onclick="$.operate.add()" shiro:hasPermission="ydz:enterprise:add">
            <i class="fa fa-plus"></i> 添加
        </a>
        <a class="btn btn-newadd single disabled" onclick="$.operate.edit()"
           shiro:hasPermission="ydz:enterprise:edit">
            <i class="fa fa-edit"></i> 修改
        </a>
        <a class="btn btn-newadd multiple disabled" onclick="$.operate.removeAll()"
           shiro:hasPermission="ydz:enterprise:remove">
            <i class="fa fa-remove"></i> 删除
        </a>
        <a class="btn btn-newadd" onclick="$.table.exportExcel()" shiro:hasPermission="ydz:enterprise:export">
            <i class="fa fa-download"></i> 导出
        </a>
    </div>
    <div class="col-sm-12 select-table table-striped ifcomebody">
        <table id="bootstrap-table"></table>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: jquery-smartwizard-js"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ydz:enterprise:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ydz:enterprise:remove')}]];
    var prefix = ctx + "ydz/enterprise";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "药企管理",
            sortName: "createTime",
            sortOrder: "desc",
            columns: [{
                checkbox: true,
            },
                        {
                            field: 'id',
                            title: '主键',
                            visible: true
                        },
                        {
                            field: 'countryName',
                            title: '国家'
                        },
                        {
                            field: 'name',
                            title: '药企名称'
                        },
                        {
                            field: 'icon',
                            title: '封面图',
                            formatter: function (value, row, index) {
                                let html = ''
                                if(value){
                                    if (value.indexOf('diseaseIcon')!=-1){
                                        html = `<div style="padding:5px;"><img src='${icon}' style="max-width:24px;max-height: 24px"></img></div>`
                                    }else{
                                        var path = value.toString();
                                        return $.table.imageView(path,'300px','480px');
                                    }
                                }
                                return html
                            }
                        },
                        // {
                        //     field: 'introduce',
                        //     title: '药企简介',
                        //     width: 400,
                        //     widthUnit: "px",
                        //     formatter: function (value, row, index) {
                        //         return $.table.tooltip(value, 26);
                        //     }
                        // },
                        {
                            field: 'title',
                            title: '标题'
                        },
                        {
                            field: 'keyword',
                            title: '关键词'
                        },
                        {
                            field: 'description',
                            title: '描述'
                        },
                        {
                            field: 'illustrate',
                            title: '说明'
                        },
                        {
                            field: 'content',
                            title: '内容'
                        },
                        {
                            field: 'createName',
                            title: '创建人名称'
                        },
                        {
                            field: 'updateName',
                            title: '更新人名称'
                        },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-caozuo btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')">编辑</a> ');
                        actions.push('<a class="btn btn-caozuo btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')">删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>